package ejb;

import java.util.ArrayList;
import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

import model.Category;

@Stateless


public class CategoryFacadeEJB implements CategoryFacadeEJBRemote {

	@PersistenceContext
	EntityManager em;
	
	@Override
	public List<Category> getAllCate() {
		List<Category> cs=null;
		try{
			String sql="select c from Category c";
			Query query=em.createQuery(sql);	
			cs=(List<Category>)query.getResultList();
		}
		catch(Exception e){
			e.printStackTrace();
			//System.out.print("in CEJB!!!***");
		}
		return cs;
	}
}
